package com.abe.libcore.base.http.interceptor

import com.abe.libcore.utils.CommonUtils
import okhttp3.Interceptor
import okhttp3.Response

class HeaderInterceptor : Interceptor {
    override fun intercept(chain: Interceptor.Chain): Response {
        return try {
            val build = chain.request().newBuilder()
                    .addHeader("Content-Type", "application/json")
                    .build()
            chain.proceed(build)
        } catch (e: Exception) {
            e.printStackTrace()
            CommonUtils.log("all-exception(HeaderInterceptor):" + e.message)
            chain.proceed(chain.request().newBuilder().build())
        }
    }
}